package com.xbk.seckill.application.builder;

import com.xbk.seckill.common.builder.SeckillCommonBuilder;
import com.xbk.seckill.common.model.dto.SeckillGoodsDTO;
import com.xbk.seckill.common.utils.beans.BeanUtil;
import com.xbk.seckill.application.command.SeckillGoodsCommond;
import com.xbk.seckill.goods.domain.model.entity.SeckillGoods;

/**
 * 秒杀商品转化类
 *
 * @author xiexu
 * @date 2025/2/4 21:36
 */
public class SeckillGoodsBuilder extends SeckillCommonBuilder {

    public static SeckillGoods toSeckillGoods(SeckillGoodsCommond seckillGoodsCommond) {
        if (seckillGoodsCommond == null) {
            return null;
        }
        SeckillGoods seckillGoods = new SeckillGoods();
        BeanUtil.copyProperties(seckillGoodsCommond, seckillGoods);
        return seckillGoods;
    }

    public static SeckillGoodsDTO toSeckillGoodsDTO(SeckillGoods seckillGoods) {
        if (seckillGoods == null) {
            return null;
        }
        SeckillGoodsDTO seckillGoodsDTO = new SeckillGoodsDTO();
        BeanUtil.copyProperties(seckillGoods, seckillGoodsDTO);
        return seckillGoodsDTO;
    }

}
